Skip to content

Remove column platform option getters#6975

Merged
morozov merged 2 commits intodoctrine:5.0.xfrom
morozov:remove-column-platform-option-getters
Jun 1, 2025
Merged

Remove column platform option getters#6975
morozov merged 2 commits intodoctrine:5.0.xfrom
morozov:remove-column-platform-option-getters

Conversation

@morozov
Copy link
Member

@morozov morozov commented May 26, 2025

This PR removes the methods deprecated in #6945. We cannot remove the setters yet (they are not yet deprecated) because there is yet no way to modify a column, which is a part of a table, which is a part of a schema (we need a schema editor).

I'm also leaving ColumnDiff::hasPlatformOptionsChanged() in place for now. I believe that replacing it with one more new method per property would be overkill. We can approach replacing it with something else separately.

As a side note / observation, the logic of normalizing tables in comparators in order to account for some default charset/collation behavior, even though it is correct, might be inefficient. We construct a new graph of objects only in order to compare it with another one as is. From the CPU/memory usage perspective, it would be more efficient to actually make the comparison more intelligent w/o creating intermediate/normalized values.

@morozov morozov added this to the 5.0.0 milestone May 26, 2025
@morozov morozov marked this pull request as ready for review May 26, 2025 04:59
@morozov morozov requested review from greg0ire and removed request for greg0ire May 26, 2025 05:00
@morozov morozov merged commit 6a72a34 into doctrine:5.0.x Jun 1, 2025
74 checks passed
@morozov morozov deleted the remove-column-platform-option-getters branch June 1, 2025 15:14
Comment on lines +131 to +136
[
static fn (Column $column): ?string => $column->getCharset(),
static fn (Column $column): ?string => $column->getCollation(),
static fn (Column $column): mixed => $column->getMinimumValue(),
static fn (Column $column): mixed => $column->getMaximumValue(),
] as $property
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since more property exists in the PlatformOptions, like, at least, enumType this doesn't give the same behavior (cf #7238)

Before when changing the enumType this method returned true ; now it returns false. (and maybe there are others important platform options)

Not sure of the impact

unset($options['collation']);
$column->setPlatformOptions($options);
($editor ??= $table->edit())
->modifyColumn($column->getObjectName(), static function (ColumnEditor $editor): void {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently

unset($options['collation']);
$column->setPlatformOptions($options);

and modifyColumn are not equivalent, because it loosing all the extra platform options not handled in the ColumnEditor, like enumType (cf #7238)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants